package com.kamistoat.meimeichat.meimeichatserverapplication.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kamistoat.meimeichat.meimeichatserverapplication.entity.MmcUserFriendEntity;
import com.kamistoat.meimeichat.meimeichatserverapplication.service.MmcUserFriendService;
import com.kamistoat.meimeichat.meimeichatserverapplication.common.utils.PageUtils;
import com.kamistoat.meimeichat.meimeichatserverapplication.common.utils.R;



/**
 * 
 *
 * @author kamistoat
 * @email linjianshanke@163.com
 * @date 2022-10-20 16:36:02
 */
@RestController
@RequestMapping("meimeichatserverapplication/mmcuserfriend")
public class MmcUserFriendController {
    @Autowired
    private MmcUserFriendService mmcUserFriendService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("meimeichatserverapplication:mmcuserfriend:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = mmcUserFriendService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    // @RequiresPermissions("meimeichatserverapplication:mmcuserfriend:info")
    public R info(@PathVariable("id") Long id){
		MmcUserFriendEntity mmcUserFriend = mmcUserFriendService.getById(id);

        return R.ok().put("mmcUserFriend", mmcUserFriend);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("meimeichatserverapplication:mmcuserfriend:save")
    public R save(@RequestBody MmcUserFriendEntity mmcUserFriend){
		mmcUserFriendService.save(mmcUserFriend);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("meimeichatserverapplication:mmcuserfriend:update")
    public R update(@RequestBody MmcUserFriendEntity mmcUserFriend){
		mmcUserFriendService.updateById(mmcUserFriend);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("meimeichatserverapplication:mmcuserfriend:delete")
    public R delete(@RequestBody Long[] ids){
		mmcUserFriendService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
